#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QLCDNumber>
#include <QPushButton>
#include <QLabel>
#include <QTimer>

#include "minesweeprwidget.h"
#include "tcp_client.h"
#include "user_info_widget.h"

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr, std::shared_ptr<tcp_client> client = nullptr);
    ~MainWindow();

    // void mousePressEvent(QMouseEvent* event);

    std::shared_ptr<MineSweeprWidget> mineSweeperWidget() const
    {
        return mineSweeperWgt_;
    }

    QPushButton &matchingButton()
    {
        return matchingButton_;
    }

    void setIsMatching(bool is_matching)
    {
        is_matching_ = is_matching;
    }

private:
    Ui::MainWindow *ui;

    std::shared_ptr<MineSweeprWidget> mineSweeperWgt_;   /* 游戏主体部分 */
    std::shared_ptr<UserInfoWidget> userInfoWgtPtr_;    /* 用户信息窗口 */
    std::shared_ptr<tcp_client> clientPtr_;

    QLCDNumber lcdNumber_;
    QPushButton matchingButton_;
    bool is_matching_ = false;
    QTimer timer_;
};
#endif // MAINWINDOW_H
